import React from 'react';
import {withRouter} from 'react-router-dom';
import {inject, observer} from 'mobx-react';
import {Toast} from 'weaver-mobile';
import {Browser} from 'weaver-mobile-page';
import * as FormUtil from "../../util/formUtil";
import base from "../../util/base";
import {getLabel} from "../../util/common";
import * as VariableKeys from '../../constants/variableKey';

@withRouter
@observer
export default class Main extends React.Component {

    render() {
        const {variableMap} = base.wfGlobalStore;
        const {workflowid, isbill, formid} = base.wfGlobalStore.commonParam;

        return (
                <Browser store={variableMap.get('reqImportStore')} hasAdvanceSerach type={16} isSingle={true}
                         conditionDataParams={{importWfBrow: '1', workflowid: workflowid}}
                         dataParams={{importWfBrow: '1', formid, isbill}}
                         searchBarProps={{placeholder: getLabel(391113,'请输入流程标题')}}
                         onOk={(id,name)=>{
                             if(id) {
                                 FormUtil.doReqImport(id);
                             } else {
                                 setTimeout(()=>{Toast.info(getLabel(84093,'请至少选择一条记录!'), 1)},400);
                             }
                         }}
                         onCleanUp={()=>{
                            const { controlVariableMap } = base.allStores.wfSignInputStore;
                            controlVariableMap(VariableKeys.CURR_OPERATE_TYPE,{});
                         }}
                />
        )
    }
}